import { computed } from "vue";
import { act } from "@/utils/websocket"; //引入websocket
import { useTagResults } from "@/utils/useTagResults";
import { operator } from "@/utils/op_enums";


// PD_52_N
export const NamePD_52_N = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_52N.PD_52_N[key], op, op_number, retain);
  });

export const NamePD_52_N_PT_52_N = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_52N.PD_52_N_PT_52_N[key], op, op_number, retain);
  });

export const NamePD_52_N_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_52N.PD_52_N_GEN[key], op, op_number, retain);
  });


// PD_52_2
export const NamePD_52_2 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_52_2.PD_52_2[key], op, op_number, retain);
  });

export const NamePD_52_2_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_52_2.PD_52_2_GEN[key], op, op_number, retain);
  });


// PD_52
export const NamePD_52 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_52_1.PD_52[key], op, op_number, retain);
  });

export const NamePD_52_PT_52 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_52_1.PD_52_PT_52[key], op, op_number, retain);
  });

export const NamePD_52_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_52_1.PD_52_GEN[key], op, op_number, retain);
  });


// PD_42_N
export const NamePD_42_N = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_42N.PD_42_N[key], op, op_number, retain);
  });

export const NamePD_42_N_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_42N.PD_42_N_GEN[key], op, op_number, retain);
  });


// PD_42_2
export const NamePD_42_2 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_42_2.PD_42_2[key], op, op_number, retain);
  });

export const NamePD_42_2_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_42_2.PD_42_2_GEN[key], op, op_number, retain);
  });


// PD_42
export const NamePD_42 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_42_1.PD_42[key], op, op_number, retain);
  });

export const NamePD_42_PT_42 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_42_1.PD_42_PT_42[key], op, op_number, retain);
  });

export const NamePD_42_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_42_1.PD_42_GEN[key], op, op_number, retain);
  });


// PD_31
export const NamePD_31 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_31.PD_31[key], op, op_number, retain);
  });

export const NamePD_31_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_31.PD_31_GEN[key], op, op_number, retain);
  });


// PD_22
export const NamePD_22 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_22.PD_22[key], op, op_number, retain);
  });

export const NamePD_22_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_22.PD_22_GEN[key], op, op_number, retain);
  });


// PD_22_N
export const NamePD_22_N = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_22N.PD_22_N[key], op, op_number, retain);
  });

export const NamePD_22_N_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_22N.PD_22_N_GEN[key], op, op_number, retain);
  });


// PD_101
export const NamePD_101 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_101.PD_101[key], op, op_number, retain);
  });

export const NamePD_101_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_101.PD_101_GEN[key], op, op_number, retain);
  });

export const NamePD_101_PT_101 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_101.PD_101_PT_101[key], op, op_number, retain);
  });


// PD_104_105
export const NamePD_104 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_104_105.PD_104[key], op, op_number, retain);
  });

export const NamePD_104_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_104_105.PD_104_GEN[key], op, op_number, retain);
  });

export const NamePD_104_PT_104 = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_104_105.PD_104_PT_104[key], op, op_number, retain);
  });

export const NamePD_104_PT_104_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(
      act.PD_104_105.PD_104_PT_104_GEN[key],
      op,
      op_number,
      retain
    );
  });


// PD_Main
export const NamePD_Main = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_ZJ.PD_Main[key], op, op_number, retain);
  });

export const NamePD_Main_GEN = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(act.PD_ZJ.PD_Main_GEN[key], op, op_number, retain);
  });

export const NamePD_Main_PT_Main = (
  key: string,
  op: operator = operator.NO,
  op_number?: number,
  retain?: number
) =>
  computed(() => {
    return useTagResults(
      act.PD_ZJ.PD_Main_PT_Main[key],
      op,
      op_number,
      retain
    );
  });
